package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.maintenancesystem.systemsetup;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.maintenancesystem.systemsetup.SystemSetupSettingService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: YangYu
 * @ClassName: SystemSetupSettingController
 * @Date: Created in 11:00 2021/1/28
 * @Description: 系统设置
 */
@Action
@RequestMapping(value = "systemsetupsetting")
public class SystemSetupSettingController extends BaseController {

    @Resource
    private SystemSetupSettingService systemSetupSettingService;

    /**
     * @Author YangYu
     * @Description 分页列表
     * @Date Created in 11:39 2020/12/21
     * @Param [jsonParam]
     */
    @At(value = "userPagList", method = RequestMethod.GET, param = {"page", "limit"})
    public RespEntity subjectionBusinessPagList(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.userPagList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 用户详情
     * @Date Created in 11:25 2021/1/6
     * @Param [jsonParam]
     */

    @At(value = "userDetail", method = RequestMethod.GET)
    public RespEntity userDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.userDetail(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 用户详情通过token
     * @Date Created in 11:25 2021/1/6
     * @Param [jsonParam]
     */

    @At(value = "userDetailByToken", method = RequestMethod.GET)
    public RespEntity userDetailByToken(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.userDetailByToken(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 用户新增
     * @Date Created in 11:25 2021/1/6
     * @Param [jsonParam]
     */

    @At(value = "userAdd", method = RequestMethod.POST)
    public RespEntity userAdd(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.userAdd(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 用户更新
     * @Date Created in 11:26 2021/1/6
     * @Param [jsonParam]
     */

    @At(value = "userUpdate", method = RequestMethod.POST)
    public RespEntity userUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.userUpdate(jsonParam);
    }
    @At(value = "wbRedirect", method = RequestMethod.POST)
    public com.alibaba.fastjson.JSONObject wbRedirect(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.wbRedirect(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 用户删除
     * @Date Created in 11:26 2021/1/6
     * @Param [jsonParam]
     */

    @At(value = "userDelete", method = RequestMethod.POST)
    public RespEntity userDelete(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.userDelete(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 指派人员列表
     * @Date Created in 10:28 2021/1/14
     * @Param [dict, httpServletRequest, response]
     */

    @At(value = "assignPersonnelList", method = RequestMethod.GET)
    public RespEntity assignPersonnelList(@RequestBody(required = false) JSONObject jsonParam, HttpServletRequest httpServletRequest, HttpServletResponse response) {
        return systemSetupSettingService.assignPersonnelList(jsonParam,httpServletRequest,response);
    }
    /**
     * @Author YangYu
     * @Description 角色列表
     * @Date Created in 11:27 2021/1/6
     * @Param [jsonParam]
     */

    @At(value = "roleList", method = RequestMethod.GET)
    public RespEntity roleList(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.roleList(jsonParam);
    }
    /**
     * @Author YangYu
     * @Description 注册
     * @Date Created in 11:37 2021/1/11
     * @Param [jsonObject, httpServletRequest]
     */

    @At(value = "/regist",method = RequestMethod.POST)
    public RespEntity regist(@RequestBody(required = false) JSONObject jsonObject, HttpServletRequest httpServletRequest){
        return this.systemSetupSettingService.regist(jsonObject,httpServletRequest);
    }
    /**
     * 登录
     * @param
     * @return
     */
    @At(value = "login", method = RequestMethod.POST, param = { "accountname","accountpassword" })
    public RespEntity login(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.login(jsonParam);
    }

    /**
     * 刷新token
     * @param
     * @return
     */
    @At(value = "refresh", method = RequestMethod.POST)
    public RespEntity refresh(@RequestBody(required = false) JSONObject jsonParam) {
        return systemSetupSettingService.refresh(jsonParam);
    }
}
